home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3535 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  856 b 

  1. Path: news.umbc.edu!not-for-mail
  2. From: schlein@umbc.edu (Jonas J. Schlein)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: strings
  5. Date: 29 Jan 1996 15:31:43 -0500
  6. Organization: University of Maryland Baltimore County
  7. Message-ID: <4ejarf$gma@umbc9.umbc.edu>
  8. References: <4eg9qj$1ut4@sp115.ocs.lsu.edu>
  9. NNTP-Posting-Host: umbc9.umbc.edu
  10. NNTP-Posting-User: schlein
  11.  
  12. Pradeep Nayar <eenaya@unix1.sncc.lsu.edu> wrote:
  13. |> I saw this piece of code in a book somewhere.  
  14. |> 
  15. |> ----
  16. |> char *str ;
  17. |> 
  18. |> str = "hello world"[10] ;
  19. |> 
  20. |> _________
  21. |> 
  22. |> what does the second line do?
  23.  
  24. It tries to assign a single character to a char * variable. In other words
  25. it's the same as:
  26.  
  27. str = 'd';
  28.  
  29. which is both illegal and meaningless. I'd recommend not using this book.
  30. -- 
  31. "If it wasn't for C, we would be using BASI, PASAL, and OBOL."
  32.  
  33. Jonas J. Schlein  (schlein@gl.umbc.edu)
  34.